Skip to content

feat: add eth2wrap/version#121

Merged
emlautarom1 merged 9 commits into
mainfrom
emlautarom1/eth2wrap/version
Jan 21, 2026
Merged

feat: add eth2wrap/version#121
emlautarom1 merged 9 commits into
mainfrom
emlautarom1/eth2wrap/version

Conversation

@emlautarom1
Copy link
Copy Markdown
Collaborator

@emlautarom1 emlautarom1 commented Jan 14, 2026

Solves #153

Validates Beacon Node client versions by leveraging the charon_core::version module.


There is an issue with the Grandine version used in the original Go implementation that is impossible to parse using the SemVer::parse method (https://github.com/ObolNetwork/charon/blob/941bb212f3065ef3551e636e7c3a1965324c21e0/app/eth2wrap/version.go#L20). This was reported to the Obol team already and the issue seems to be upstream: the Grandine team is not following the correct semver naming format.

On our side, the fix implies changing v2.0.0.rc0 to v2.0.0-rc0

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds beacon node version validation functionality to the charon crate by implementing a new eth2wrap/version module. The implementation validates Beacon Node client versions against defined minimum versions using the existing charon_core::version module and regex pattern matching.

Changes:

  • Adds version validation for six Beacon Node clients (Lighthouse, Teku, Lodestar, Nimbus, Prysm, and Grandine)
  • Implements regex-based version extraction and semantic version comparison
  • Includes comprehensive test coverage for version validation logic

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
flake.nix Sets RUSTC_BOOTSTRAP=1 environment variable for the development shell
crates/charon/src/lib.rs Adds public module declaration for eth2wrap
crates/charon/src/eth2wrap/version.rs Implements beacon node version checking with validation logic and tests
crates/charon/src/eth2wrap/mod.rs Module file declaring the version submodule
crates/charon/Cargo.toml Adds regex dependency
Cargo.toml Moves regex from dev-dependencies to workspace dependencies
Cargo.lock Updates dependency versions (primarily Alloy crates and regex placement)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread flake.nix
Comment thread crates/charon/src/eth2wrap/version.rs
Comment thread crates/charon/src/eth2wrap/version.rs
if client < minimum {
return Err(BeaconNodeVersionError::TooOld { client, minimum });
}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a bad version checking: https://github.com/ObolNetwork/charon/blob/main/app/eth2wrap/version.go#L70-L74

But when i searched the golang implementation, it seems there are no places modify this map. Do we want to add that implementation here?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not include it since - as you mention - there is no way at runtime to modify this map, and currently it's empty, so in practice is essentially dead code.


let name = &matches[1];
let minimum = MINIMUM_BEACON_NODE_VERSIONS
.get(&name.to_lowercase().as_str())
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: golang implementation is case sensitive

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, but I think it's safe to use lowercase everywhere (could be an issue on their side).

Copy link
Copy Markdown
Collaborator

@varex83 varex83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@emlautarom1 emlautarom1 merged commit 4b6aa1f into main Jan 21, 2026
7 checks passed
@emlautarom1 emlautarom1 deleted the emlautarom1/eth2wrap/version branch January 21, 2026 23:25
@emlautarom1 emlautarom1 linked an issue Jan 28, 2026 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement eth2wrap/version

4 participants